﻿using System.Data;
using smp.QueryDb.Structure;

namespace smp.QueryDb.Tests
{
    #region database class

    public class QueryDbTest
    {
        public static Address Address = new Address();
        public static Customer Customer = new Customer();
        public static Order Order = new Order();
        public static OrderProducts OrderProducts = new OrderProducts();
        public static Product Product = new Product();
        public static DeleteAllData DeleteAllData = new DeleteAllData();
    }

    #endregion

    #region Tables and Views

    public class Address : Table
    {
         public Address() : base("QueryDbTest", "dbo", "Address")
        {
            Id = SetId("Id", DbType.Guid, IdGenerationType.ApplicationGenerated);
            County = AddColumn("County", DbType.String, true);
            HouseName = AddColumn("HouseName", DbType.String, true);
            HouseNumber = AddColumn("HouseNumber", DbType.Int32, true);
            Line1 = AddColumn("Line1", DbType.String, true);
            Line2 = AddColumn("Line2", DbType.String, true);
            PostCode = AddColumn("PostCode", DbType.String, true);
            Town = AddColumn("Town", DbType.String, true);
        }
        public static Id Id;
        public static Column County;
        public static Column HouseName;
        public static Column HouseNumber;
        public static Column Line1;
        public static Column Line2;
        public static Column PostCode;
        public static Column Town;
    }

    public class Customer : Table
    {
         public Customer() : base("QueryDbTest", "dbo", "Customer")
        {
            Id = SetId("Id", DbType.Guid, IdGenerationType.ApplicationGenerated);
            AddressId = AddColumn("AddressId", DbType.Guid, true);
            ContactNumber = AddColumn("ContactNumber", DbType.String, true);
            Created = AddColumn("Created", DbType.DateTime, true);
            Email = AddColumn("Email", DbType.String, true);
            Name = AddColumn("Name", DbType.String, true);
            Type = AddColumn("Type", DbType.Int32, true);
        }
        public static Id Id;
        public static Column AddressId;
        public static Column ContactNumber;
        public static Column Created;
        public static Column Email;
        public static Column Name;
        public static Column Type;
    }

    public class Order : Table
    {
         public Order() : base("QueryDbTest", "dbo", "Order")
        {
            Id = SetId("Id", DbType.Guid, IdGenerationType.ApplicationGenerated);
            CustomerId = AddColumn("CustomerId", DbType.Guid, true);
            Name = AddColumn("Name", DbType.String, true);
        }
        public static Id Id;
        public static Column CustomerId;
        public static Column Name;
    }

    public class OrderProducts : Table
    {
         public OrderProducts() : base("QueryDbTest", "dbo", "OrderProducts")
        {
            Id = SetId("Id", DbType.Guid, IdGenerationType.ApplicationGenerated);
            OrderId = AddColumn("OrderId", DbType.Guid, true);
            ProductId = AddColumn("ProductId", DbType.Guid, true);
        }
        public static Id Id;
        public static Column OrderId;
        public static Column ProductId;
    }

    public class Product : Table
    {
         public Product() : base("QueryDbTest", "dbo", "Product")
        {
            Id = SetId("Id", DbType.Guid, IdGenerationType.ApplicationGenerated);
            Cost = AddColumn("Cost", DbType.Decimal, true);
            Name = AddColumn("Name", DbType.String, true);
        }
        public static Id Id;
        public static Column Cost;
        public static Column Name;
    }

    #endregion

    #region Procedures

    public class DeleteAllData : Procedure
    {
         public DeleteAllData() : base("QueryDbTest", "dbo", "DeleteAllData")
        {
        }
    }

    #endregion

}

